<div>
  <div class="main-title">
    <h2>{if $id}编辑{else}新增{/if}房号</h2>
  </div>
  <div class="main-section">
    <form method="POST" action="{:url('save')}" class="j-form">
      <ul class="form-group form-inline">
        <li>
          <select name="house_property_id" class="form-control" style="min-width: 196px;">
            <option value="0">未选择</option>
            {foreach $property as $v}
            <option value="{$v.id}" {if $v.id===$data.house_property_id}selected{/if}>{$v.name}</option>
            {/foreach}
          </select>
          <label>房产</label>
        </li>
        <li>
          <input type="text" class="form-control" name="name" value="{$data.name}" data-toggle="tooltip"
            data-placement="top" required>
          <label>名称</label>
        </li>
        <li>
          <input type="text" class="form-control" name="rental" value="{$data.rental}" data-toggle="tooltip"
            data-placement="top" required>
          <label>租金</label>
        </li>
        <li>
          <input type="text" class="form-control" name="deposit" value="{$data.deposit}" data-toggle="tooltip"
          data-placement="top" required>
          <label>押金</label>
        </li>
        <li>
          <input type="text" class="form-control" name="garbage_fee" value="{$data.garbage_fee}" data-toggle="tooltip"
            data-placement="top" required>
          <label>垃圾费</label>
        </li>
        <li>
          <input type="text" class="form-control" name="daily_rent" value="{$data.daily_rent}" data-toggle="tooltip"
            data-placement="top" required>
          <label>逾期日租金</label>
        </li>
        <li>
          <input type="text" class="form-control" name="electricity_price" value="{$data.electricity_price}" data-toggle="tooltip"
            data-placement="top" required>
          <label>电费单价</label>
        </li>
        <li>
          <input type="text" class="form-control" name="water_price" value="{$data.water_price}" data-toggle="tooltip"
            data-placement="top" required>
          <label>水费单价</label>
        </li>
        <li>
          <input type="hidden" name="id" value="{$id}">
          <input type="submit" value="提交表单" class="btn btn-primary">
          <a href="{:url('index', ['house_property_id' => $data.house_property_id])}" class="btn btn-default">返回列表</a>
        </li>
      </ul>
    </form>
  </div>
</div>

<script>
  main.ajaxForm('.j-form', function () {
    main.content("{:url('index', ['house_property_id' => $data.house_property_id])}");
  });
  $('[data-toggle="tooltip"]').tooltip();
</script>